#ifndef NF_SECURITY_MODULE_H
#define NF_SECURITY_MODULE_H

#include <memory>
#include "PluginModule/ILogModule.h"
//#include "Common/Interface/IKernelModule.h"
//#include "Common/Interface/IClassModule.h"
#include "PluginModule/ISecurityModule.h"
//#include "Common/Interface/IElementModule.h"

namespace FragrantGrass
{
	class SecurityModule
		: public ISecurityModule
	{
	public:
		SecurityModule(IPluginManager* p)
		{
			m_pPluginManager = p;
		}

		virtual bool Init();
		virtual bool Shut();
		virtual bool Execute();

		virtual bool AfterInit();

		//when a user login FG system, as a security module, you need to grant user an key.
		virtual const std::string& GetSecurityKey(const std::string& strAcount);

		//when the user want to connect to proxy, as a user need to provide the key that got in login system.
		virtual bool VirifySecurityKey(const std::string& strAcount, const std::string& strSucrityKey);

		//when the user want to post a message to proxy, the message-data need to be virified.
		virtual std::string EncodeMsg(const std::string& strAcount, const std::string& strSucrityKey, const int nMessageID, const char* strMessageData, const int nLen);
		virtual std::string EncodeMsg(const std::string& strAcount, const std::string& strSucrityKey, const int nMessageID, const std::string& strMessageData);
		virtual std::string DecodeMsg(const std::string& strAcount, const std::string& strSucrityKey, const int nMessageID, const char* strMessageData, const int nLen);
		virtual std::string DecodeMsg(const std::string& strAcount, const std::string& strSucrityKey, const int nMessageID, const std::string& strMessageData);

	protected:

		//////////////////////////////////////////////////////////////////////////
		//IKernelModule* m_pKernelModule;
		//IClassModule* m_pClassModule;
		ILogModule* m_pLogModule;
		//IElementModule* m_pElementModule;
		//////////////////////////////////////////////////////////////////////////
	};
}
#endif
